#pragma once
#include <atomic>
#include <condition_variable>
#include <hiredis/hiredis.h>
#include <memory>
#include <mutex>
#include <queue>
class RedisConPool {

private:
  std::queue<std::unique_ptr<redisContext>> _connections;
  std::mutex _mutex;
  std::condition_variable _cond;
  std::unique_ptr<redisContext> _connection;
  std::atomic<bool> _b_stop;

public:
  RedisConPool();
  std::unique_ptr<redisContext> GetConnection();
  void ReturnConnection(std::unique_ptr<redisContext> con);
  void Close();
};